﻿using System;
using jSLCore.Client.Presentation.BaseControl;
using jSLCore.Client.Presentation.BaseControl.DialogMessage;

namespace jSLApp.Client.Forms
{
    public partial class SendMail : DialogControl
    {
        public SendMail()
        {
            InitializeComponent();
        }

        #region dialog

        public override void OkClicked()
        {
            var dlg = new QuestionBox("Send message?", QuestionBoxType.YesNo);
            dlg.ShowDialog(delegate(object sender, object data)
            {
                this.DoWorkOnVoidOperation("Message sending",context => context.SendFeedback(txt.Text),b =>
                                                                                            {
                                                                                                if (!b)
                                                                                                {
                                                                                                    InvokeDataSelected();
                                                                                                    InfoBox.ShowDialog("Message sent");
                                                                                                }
                                                                                            });
            });
        }
        
        public override bool IsOkVisible
        {
            get { return true; }
        }

        public override bool IsStandartOkCancelEnabled
        {
            get { return true; }
        }

        public override object OkContent
        {
            get { return "Send"; }
        }
        
        public override bool AutoSize
        {
            get { return true; }
        }

        public override void LoadInitialData()
        {
            
        }

        #endregion
    }
}
